package com.venus.config.activemq;

import com.alibaba.fastjson.JSONObject;
import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import java.util.Map;

/**
 * Created by admin on 14/11/17.
 */
@Component()
public class Comsumer {

	@JmsListener(destination = "venus.order")
	public void receiveQueue(final ActiveMQTextMessage message) {
		try {
			System.out.println(message);
			Map<String,Object> map = (Map<String,Object>)JSONObject.parse(message.getText());
			System.out.println("Consumer收到的报文为:"+ map.get("name"));
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}
}
